package com.nestease.qa.dao.api

import com.nestease.qa.dao.entity.User
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Param
import org.apache.ibatis.annotations.Select

/**
 * @author zoudongdong
 * @date 2018/2/20
 */
interface UserDAO {

    @Select("""
            select *
            from LG_user
            where userName=#{userName}
            and pwd=#{pwd}
            and status=1
            """)
    public User verifyLogin(User user);

    @Select("""
            select userName
            from LG_user
            where userId=#{userId}
            """)
    public String getUserNameByUserId(String userId);

    @Insert("""
            INSERT INTO `LG_user` (`userId`, `userName`, `pwd`, `status`)
            VALUES (#{userId}, #{userName}, #{pwd}, #{status});
            """)
    public void userRegister(User user);

    @Select("""
            select count(*)
            from LG_user
            where userName=#{userName}
            and status=1
            """)
    public int verifyUserName(String userName);
}
